import React from 'react';
import Footer from '../calendar/footer';
import {  withRouter } from 'react-router-dom';

@withRouter
class App extends React.Component {
  componentDidMount() {

  }

  isFooterVisible = () => {
    const { pathname } = this.props.location;
    const { action } = this.props.history;
    let isVisible = true;
    if (pathname === '/calendar/myFllow' || pathname === '/calendar/subordinate') {
      if (action === "POP" && localStorage.userName) {
        isVisible = false;
      }
      if (action === "PUSH") {
        isVisible = false;
      }
    }   
    if (pathname.indexOf('create') > -1 || pathname.indexOf('detail') > -1) {
      isVisible = false;
    }
    return isVisible;
  }

  render() {
    
    return <div className="schdule" style={{height: '100%'}}> 
      <div id='main-container' style={{height: this.isFooterVisible() ? 'calc(100% - 50px)' : '100%'}}>{this.props.children}</div>
      {this.isFooterVisible() && <Footer />}
    </div>
  }
}

export default App;